package com.lib.torment.androidlib.utils;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.lib.torment.androidlib.R;

/**
 * 适配器加载更多工具类
 * Created by torment on 16-7-15.
 */
public class AdapterViewUtils {
    /**
     * 设置一个加载更多的布局
     *
     * @param context 上下文
     * @return 加载更多的布局View
     */
    public static View setLoadingMoreView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.adapter_buttom_empty_progress, null);
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        view.setLayoutParams(layoutParams);
        return view;
    }

    /**
     * 设置一个加载是没有数据的布局
     *
     * @param context   上下文
     * @param viewGroup 父容器
     * @return 加载更多的布局View
     */
    public static View setNoLoadingMoreView(Context context, ViewGroup viewGroup) {
        View view = LayoutInflater.from(context).inflate(R.layout.adapter_bottom_not_loading, viewGroup, false);
        return view;
    }
}
